package threads.thread1;

public class VolatileCanStop {

    //public static boolean  stopFlag = true;

    /*public static Runnable myThread = () -> {

        int num = 0;

        while (num < 100000 && stopFlag ){
            if(num % 10 == 0){
                System.out.println(num + ": 是10的倍数");
            }
            num++;
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    };*/

    public static void main(String[] args) throws InterruptedException {

        /*Consumer.MyThread2 myThread2 = new Consumer.MyThread2();
        Thread thread = new Thread(myThread2);
        thread.start();
        Thread.sleep(6000);
        myThread2.stopFlag = false;*/
    }

    /*class MyThread2 implements Runnable{

        int num = 0;

        @Override
        public void run() {
            while (num < 100000 && stopFlag ){
                if(num % 10 == 0){
                    System.out.println(num + ": 是10的倍数");
                }
                num++;
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }*/
}
